package cn.wolfcode.trip.app.controller;

import cn.wolfcode.trip.base.domain.Collectionce;
import cn.wolfcode.trip.base.domain.StrategyComment;
import cn.wolfcode.trip.base.query.CollectionceQueryObject;
import cn.wolfcode.trip.base.query.StrategyCommentQueryObject;
import cn.wolfcode.trip.base.service.ICollectionceService;
import cn.wolfcode.trip.base.service.IStrategyCommentService;
import cn.wolfcode.trip.base.util.JsonResult;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.swing.*;
import java.util.List;

@RestController
@RequestMapping("collectionces")
public class CollectionceController {
    @Autowired
    private ICollectionceService collectionceService;

    /**
     * 通过参数获取收藏信息
     * @param qo
     * @return
     */
    @GetMapping
    public PageInfo selectById(CollectionceQueryObject qo){
        return collectionceService.selectById(qo);
    }

    /**
     * 查询判断是否有对应的参数信息
     * @param qo
     * @return
     */
    @GetMapping("/statusId")
    public boolean select(CollectionceQueryObject qo){
        return collectionceService.selectId(qo);
    }
    @PostMapping
    public JsonResult save(CollectionceQueryObject qo){
        collectionceService.save(qo);
        return new JsonResult();
    }
    @PutMapping
    public JsonResult delete(CollectionceQueryObject qo){
        collectionceService.delete(qo);
        return new JsonResult();
    }

    @GetMapping("/strategyId")
    public Integer selectstrategyId(Long strategyId){
        return collectionceService.selectstrategyId(strategyId);
    }

}
